#!/bin/bash
### Run script for FrostWire.
### Builds a classpath for all jars & components.
if [ -z ${JAVA_HOME} ]; then
   echo "Error: I don't know where is your Java Virtual Machine."
   echo "Please make sure to set your JAVA_HOME environment variable."
   exit 1
fi

CLASSPATH=build/libs/frostwire.jar
PS=":"

OPTS="-Xms64m -Xmx512m -Xss256k -Djava.library.path=lib/native"

OPTS="${OPTS} -Dcom.sun.management.jmxremote.port=9595"
OPTS="${OPTS} -Dcom.sun.management.jmxremote.ssl=false"
OPTS="${OPTS} -Dcom.sun.management.jmxremote.authenticate=false"
OPTS="${OPTS} -Djava.rmi.server.hostname=127.0.0.1"
OPTS="${OPTS} -agentlib:jdwp=transport=dt_socket,address=9696,server=y,suspend=n"

export CLASSPATH
echo Classpath:
echo $CLASSPATH

export JAVA_BIN=${JAVA_HOME}/bin/java

echo Java Home:
echo ${JAVA_HOME}

echo Java Binary:
echo ${JAVA_BIN}
echo Java Version:
$JAVA_BIN -version
echo
echo "Let's go!"

${JAVA_BIN} ${OPTS} -Ddebug=1 com.limegroup.gnutella.gui.Main $*
